package org.tlipoca.smsteamuserstore.listener;

import lombok.RequiredArgsConstructor;
import org.genntii.smdomain.entity.SteamUserStore;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.tlipoca.smsteamuserstore.service.SteamUserStoreService;

@Component
@RequiredArgsConstructor
public class OpenIdListener {

    private final SteamUserStoreService service;

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "openid1.queue", durable = "true"),
            exchange = @Exchange(name = "openid1.topic",type = "topic"),
            key = "openid.routingKey"
    ))
    public void receiver(String steamid){
        service.getSteamUserStoreBySteamIdService(Long.valueOf(steamid));
    }

}
